// const http = uni.$u.http;
export const api = {
	login: '/sys/user/login',
	logout: 'sys/user/logout', //退出登录
	getUserInfo: 'sys/user/info',
	refreshToken: 'sys/user/refresh', //刷新token
	updatePass: 'sys/user/updatePass', //修改密码
	getMd5PassIsNull: '/sys/user/getMd5PassIsNull', //获取用户是否有md5密码
	/* 新——修改用户信息 */
	updateInfo: '/sys/user/updateInfo',
	register: '/sys/user/wxReg', //注册
	addAccountUser: '/sys/userDetail/insert', //新增用户
	editAccountUser: '/sys/userDetail/update', //编辑用户
	getDictItemKeyList: '/sys/dict/getDictByItem',
	getAccountUserList: '/sys/userDetail/selectBy',
	getplanList: '/sys/userDetail/selectByNew', //查询每一天的计划
	getpatientList: '/sys/patient/wxQuery', //wx首页医生或者归属团队的病人
	getSchelduleList:"/sys/HospSchedule/getCalendar",//获取日程

	getAccountUser: '/sys/userDetail/detail',
	uploadFile: process.env.VUE_APP_BASE_URL + '/sys/upload', //文件上传返回url
	AddSignIn: '/sys/HospSign/AddSignIn', //新增签到
	getSignInToday: '/sys/HospSign/getSignInToday', //查询进入签到
	getDoctorId: '/sys/docterNurses/getDoctorId',//查询医护id
	getCurrentHospPatientInfo:'/sys/patient/wx/getCurrentHospPatientInfo',//获取首页保存的病人信息
	setCurrentHospPatientInfo: '/sys/patient/wx/setCurrentHospPatientInfo',//设置首页病人信息

}
export const deviceapi = {
	getProTypeList: '/sys/prodType/selectBy',
	getDeviceTypeList: '/sys/deviceType/selectBy',
	addDevice: '/sys/sysDevice/insert',
	getDeviceList: '/sys/sysDevice/selectBy',
	delDevice: '/sys/sysDevice/deleteById',
	getWeightData: '/sys/device/getWeightData', //获取体脂秤7天内每天平均值
	getBP2AData: '/sys/device/getBP2AData', //获取最后一次血压数据
	getO2AData: '/sys/device/getO2AData', //获取最后一次血氧数据
	findEcgFirstPage: '/sys/device/findEcgFirstPage', //获取首页心电数据
	getEcgDetail: '/sys/device/getEcgDetail', //获取详细界面心电数据
	getWeightlist: '/sys/weight/page', //体重历史列表
	getWeightCount: '/sys/weight/tongjiQuery', //体重统计
	getBP2ACount: '/sys/BP2A/tongjiQuery',
	getBP2ACountOfTj: '/sys/BP2A/getCountOfTj',
	getBP2Alist: '/sys/BP2A/page',
	getO2list: '/sys/O2/page',
	getO2Count: '/sys/O2/tongjiQuery',
	getWeightCountByDay: '/sys/weight/findByCond',

	getWeightLatest: '/sys/weight/getLatest', //获取今天最后一次体重记录
	getBP2ALatest: '/sys/BP2A/getLatest', //获取今天最后一次血压记录
	getO2Latest: '/sys/O2/getLatest', //获取今天最后一次血氧记录
	getBoLatest: '/sys/Bo/getLatest', //获取今天最后一次血糖记录
	
	getdocBP2ALatest:'/sys/docBP2A/getLatest', //获取今天最后一次血压记录
	getdocO2Latest:'/sys/docO2/getLatest', //获取今天最后一次血氧记录
	getdocBoLatest:'/sys/docBo/getLatest', //获取今天最后一次血糖记录
	

}
export const groupapi = {
	createGroup: '/sys/group/create', //创建分组
	addGroup: '/sys/group/add', //加入分组
	getGroup: '/sys/group/query', //查询分组
	delGroup: '/sys/group/del', //删除成员
}
// test get api
export function getAction(url, params, config = {}) {
	return http.get(url, params, {
		...config
	})
}

// test post api
export function postAction(url, params, config = {}) {
	return uni.$u.http.post(url, params, config)
}
export function setToken(refreshToken) {
	return postAction(api.refreshToken, refreshToken)
}
export function logout() {
	return postAction(api.logout)
}
export function getUserInfo() {
	return postAction(api.getUserInfo, null, {
		custom: {
			ShowLoading: false
		}
	})
}
export function getDoctorId() {
	return postAction(api.getDoctorId, null, {
		custom: {
			ShowLoading: false
		}
	})
}

export function getAccountUserList(userId, param) {
	return postAction(api.getAccountUserList, {
		userId,
		patriRelationCode: 7,
		...param
	})
}
export function getPreMenu() {
	return postAction(api.getPreMenu)
}
export function downCourse(csId) {
	return postAction(courseapi.downCourse + '?csId=' + csId)
}